package cmpe451.group7.ourcity.dao;

import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.List;

import cmpe451.group7.ourcity.entity.Comment;
import cmpe451.group7.ourcity.entity.Place;
import cmpe451.group7.ourcity.entity.User;

public interface UserDAO extends GenericDAO<User> {

	/**
	 * Inserts a new user to the database
	 * 
	 * @param name
	 * @param surname
	 * @param email
	 * @param password
	 * @return null if there is an error. otherwise persisted user is returned
	 * @throws NoSuchAlgorithmException
	 * @throws InvalidKeySpecException
	 */
	User insertNewUser(String name, String surname, String email,
			String password) throws NoSuchAlgorithmException,
			InvalidKeySpecException;

	/**
	 * Find user in the database using its unique email
	 * 
	 * @param email
	 * @return
	 */
	User findUserByEmail(String email);

	/**
	 * update the user info text of the user with the given id
	 * 
	 * @param userInfo
	 * @param userID
	 * @return
	 */
	User updateUserInfo(String userInfo, Long userID);

	/**
	 * update the user about me text of the user with the given id
	 * 
	 * @param aboutMe
	 * @param userID
	 * @return
	 */
	User updateAboutMe(String aboutMe, Long userID);

	/**
	 * Returns all comments of the user
	 * 
	 * @param user
	 * @return
	 */
	List<Comment> getCommentsofUser(User user);

	/**
	 * Add the given place to the liked places of the user
	 * 
	 * @param place
	 * @param user
	 * @return
	 */
	boolean likePlace(Place place, User user);

	/**
	 * Get the liked places of the user
	 * 
	 * @param user
	 * @return
	 */
	List<Place> getLikedPlace(User user);

}
